//
//  QQAuthResult.m
//  test1
//
//  Created by gengzhangjia on 15/8/4.
//  Copyright (c) 2015年 gengzhangjia. All rights reserved.
//

#import "QQAuthResult.h"

@implementation QQAuthResult
+ (instancetype) success
{
    QQAuthResult *qqAuthResult = [QQAuthResult alloc];
    qqAuthResult.resultCode = QQResultCodeSuccess;
    qqAuthResult.errorInfo = @"登录成功";
    return qqAuthResult;
}

+ (instancetype) userCancelError
{
    QQAuthResult *qqAuthResult = [QQAuthResult alloc];
    qqAuthResult.resultCode = QQAuthResultUserCancel;
    qqAuthResult.errorInfo = @"用户取消登录";
    return qqAuthResult;
}

+ (instancetype) generalError
{
    QQAuthResult *qqAuthResult = [QQAuthResult alloc];
    qqAuthResult.resultCode = QQResultCodeEndFaild;
    qqAuthResult.errorInfo = @"其它登录错误";
    return qqAuthResult;
}

+ (instancetype) parseData:(APIResponse *) response
{
    QQAuthResult *qqAuthResult = [QQAuthResult success];
    NSString *nickname = [response.jsonResponse objectForKey:@"nickname"];
    NSString *url = [response.jsonResponse objectForKey:@"figureurl_qq_2"];
    NSString *gender = [response.jsonResponse objectForKey:@"gender"];
    qqAuthResult.nickName = nickname;
    qqAuthResult.url = url;
    qqAuthResult.gender = gender;
    return qqAuthResult;
}
@end
